The present invention relates in general to data storage, and more particularly, to altering Time to Live (TTL) values in a data cache in response to cost factors.
A cache is an in-memory storage component that transparently stores data so that future requests for that data can be served faster. The data that is stored may be previously computed values or copies of values stored elsewhere. Since cache size is relatively small, there is typically more data than the available amount of in-memory storage. Thus, data caches usually implement an eviction policy such as, Time to Live (TTL), Least Recently Used (LRU), or Least Frequently Used (LFU), each of which usually define a fixed value based on the client's tolerance for stale data and the amount of space available in the cache. The eviction policies do not take into account the expense for recreating the data if it is requested once it has been evicted. It is oftentimes desirable to temporarily increase the size of the cache and increase the eviction policy window during anticipated or actual higher volumes of traffic through a provisioning process.
There are also use cases where the cost to re-create the data in the cache outweighs the cost of reading stale data. For example, if the database is unreachable or the connection to the database has been saturated, then having the eviction policy temporarily disabled or increased is more beneficial than having the user wait indefinitely or suffer a connection timeout, which can cascade the database problem to the front-end systems.